home *** CD-ROM | disk | FTP | other *** search
- property spriteList, len -- Sprites a serem movidos juntos
- property editableList
- property permiteIdle
- property ligado
- property ondouble
-
- on getBehaviorDescription
- return "Arrasta sprites com o click do mouse"
- end
-
- on getPropertyDescriptionList
- set p_list = [ ¬
- #spriteList: [ #comment: "Lista de sprites a serem arrastados", ¬
- #format: #list, ¬
- #default: [0] ], ¬
- #editableList: [ #comment: "Sprites editaveis que devem ser desligados antes de serem arrastados",¬
- #format: #list,¬
- #default: [] ],¬
- #permiteIdle: [ #comment: "Permite funcionamento de outros sprites durante arraste", ¬
- #format: #boolean, ¬
- #default: false ], ¬
- #ondouble: [ #comment: "Permite funcionamento de outros sprites durante arraste", ¬
- #format: #string, ¬
- #default: "" ] ¬
- ]
- return p_list
- end
-
- -- Guarda count para acesso rapido
- on beginSprite me
- put count(spriteList) into len
- set ligado = true
- end
-
- -- Liga ou desliga sprites
- on chaveVisibilidade me, liga
- if liga then
- if not ligado then
- repeat with i = 1 to len
- put getAt(spriteList,i) into s
- set the locV of sprite s to (the locV of sprite s) - 480
- end repeat
- end if
- set ligado = true
- else
- if ligado then
- repeat with i = 1 to len
- put getAt(spriteList,i) into s
- set the locV of sprite s to (the locV of sprite s) + 480
- end repeat
- end if
- set ligado = false
- end if
- repeat with i = 1 to len
- set the visible of sprite (getAt(spriteList,i)) to liga
- end repeat
- end
-
- -- Desloca todos os componetes do popup
- on moveRelativo me, dx, dy
- repeat with i = 1 to len
- put getAt(spriteList,i) into s
- set the locH of sprite s to (the locH of sprite s) + dx
- set the locV of sprite s to (the locV of sprite s) + dy
- end repeat
- end
-
- -- Liga/desliga campos editaveis: recomenda-se update stage
- -- depois
- on chaveEditaveis me, liga
- put count(editableList) into l
- repeat with i=1 to l
- set the editable of sprite getAt(the editableList of me,i) to liga
- end repeat
- end
-
- on mouseDown me
- -- Pega posicoes iniciais
- put the mouseH into iniX
- put the mouseV into iniY
-
- -- Desliga editaveis
- chaveEditaveis me, false
- if count(the editableList of me) > 0 then updateStage
-
- -- Loop enquanto pessoa segura mouse
- repeat while the mouseDown
- if the mouseV <> iniY or the mouseH <> iniX then
- put the mouseV into mY
- put the mouseH into mX
- moveRelativo me, mX - iniX, mY - iniY
- updateStage
- put mY into iniY
- put mX into iniX
- end if
- if permiteIdle then SendAllSprites(#IdleSprite)
- end repeat
-
- -- Liga editaveis
- chaveEditaveis me, true
- if count(the editableList of me) > 0 then updateStage
- end
-
- on mouseUp
- if the doubleClick and ondouble <> "" then
- global gPronde
- set gPronde = 0
- calculaDonde
- sendAllSprites(#cleanSprite)
- go frame ondouble
- end if
- end